home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / cuj0696.zip / DWYER.ZIP / RUN.TST / TSTMNSD.C < prev   
C/C++ Source or Header  |  1996-02-29  |  926b  |  33 lines

  1. /* ============ */
  2. /* tstmnsd.c    */
  3. /* ============ */
  4. /* ====================================================================    */
  5. /*        Tests Function RunMeanStdDev                */
  6. /* ====================================================================    */
  7. #include <assert.h>
  8. #include <stdio.h>
  9. #include <miscdefs.h>
  10. #include <math.h>
  11.  
  12. void
  13. main()
  14. {
  15.     while (main)
  16.     {
  17.     UINT    NumSegs, SetSize, Unique;
  18.     double    Mean, StdDev;
  19.  
  20.     AbortGracefully();
  21.  
  22.     GetUint("Enter Number of Integers in Data Set:    ", &SetSize);
  23.     GetUint("Enter Number of Unique Integers Desired: ", &Unique);
  24.     GetUint("Enter Number of Segments to be Counted:  ", &NumSegs);
  25.  
  26.     RunMeanStdDev(SetSize, Unique, &Mean, &StdDev);
  27.     printf("%15u  Unique Integers\n%15u  Segments\n",
  28.         Unique, NumSegs);
  29.     printf("%15.f  Mean Number of Variates Required\n", NumSegs * Mean);
  30.     printf("%15.f  Standard Deviation\n", StdDev * sqrt(NumSegs)));
  31.     }
  32. }
  33.